home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / The Hacks! / COSEmulator / COSEmulator- SRC / src / AlertDialog.cpp next >
Encoding:
Text File  |  1998-06-21  |  4.2 KB  |  170 lines  |  [TEXT/CWIE]

  1. //===================================================================
  2. //=======================  Headers        =============================
  3.  
  4. #include "AlertDialog.h"
  5. #include "GameUtilities.h"
  6. #include "Screen.h"
  7.  
  8. //===================================================================
  9. //=======================  Globals        =============================
  10.  
  11. //===================================================================
  12. //=======================  #define        =============================
  13.  
  14.  
  15. //===================================================================
  16. //=======================  Function Prototypes    =====================
  17.  
  18. /*----------------------------------------------------------------------------\
  19.  
  20.     AlertDialog :: Constructor
  21.  
  22. \----------------------------------------------------------------------------*/
  23.     AlertDialog :: AlertDialog( void )
  24.                 : Window()
  25. {
  26.     
  27. }
  28.  
  29. /*----------------------------------------------------------------------------\
  30.  
  31.     AlertDialog :: SetDialog
  32.  
  33. \----------------------------------------------------------------------------*/
  34. void    AlertDialog :: SetDialog( char type , char *message , Boolean center )
  35. {
  36.     
  37. }
  38.  
  39. /*----------------------------------------------------------------------------\
  40.  
  41.     AlertDialog :: Init
  42.  
  43. \----------------------------------------------------------------------------*/
  44. Boolean    AlertDialog :: Init( void )
  45. {
  46.     if( window.LoadPicBuff( 128 ) )
  47.     {
  48.         screenLoc.left = 0;
  49.         screenLoc.top = 0;
  50.         screenLoc.right = width = window.GetBoundsSize().right;
  51.         screenLoc.bottom = height = window.GetBoundsSize().bottom;
  52.         
  53.         return true;
  54.     }
  55.     
  56.     return false;
  57. }
  58.  
  59. /*----------------------------------------------------------------------------\
  60.  
  61.     AlertDialog :: HandleMouseClick
  62.  
  63. \----------------------------------------------------------------------------*/
  64. void    AlertDialog :: HandleMouseClick( Boolean down , point where )
  65. {
  66.     if( down )
  67.     {
  68.         draging = true;
  69.         start = where;
  70.     }
  71.     else
  72.     {
  73.         if( draging )
  74.         {
  75.             screen.AddRectToUpdate( screenLoc );
  76.             
  77.             MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
  78.  
  79.             screen.AddRectToUpdate( screenLoc );
  80.             
  81.             draging = false;
  82.         }
  83.     }
  84. }
  85.  
  86. /*----------------------------------------------------------------------------\
  87.  
  88.     AlertDialog :: HandleMouseMove
  89.  
  90. \----------------------------------------------------------------------------*/
  91. void    AlertDialog :: HandleMouseMove( point where )
  92. {
  93.     if( draging )
  94.     {
  95.         screen.AddRectToUpdate( screenLoc );
  96.         
  97.         MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
  98.         start = where;
  99.         
  100.         screen.AddRectToUpdate( screenLoc );
  101.     }
  102. }
  103.  
  104. /*----------------------------------------------------------------------------\
  105.  
  106.     AlertDialog :: PointInWindow
  107.  
  108. - just saids if the point it inside the window area or not
  109. \----------------------------------------------------------------------------*/
  110. Boolean    AlertDialog :: PointInWindow( point where )
  111. {
  112.     return SectPtRect( where , screenLoc );
  113. }
  114.  
  115. /*----------------------------------------------------------------------------\
  116.  
  117.     AlertDialog :: Active
  118.  
  119. \----------------------------------------------------------------------------*/
  120. Boolean    AlertDialog :: Front( void )
  121. {
  122.     return( front );
  123. }
  124.  
  125. /*----------------------------------------------------------------------------\
  126.  
  127.     AlertDialog :: SetFront
  128.  
  129. \----------------------------------------------------------------------------*/
  130. void    AlertDialog :: SetFront( Boolean f )
  131. {
  132.     if( f != front )
  133.     {
  134.         front = f;
  135.         screen.AddRectToUpdate( screenLoc );
  136.     }
  137. }
  138.  
  139. /*----------------------------------------------------------------------------\
  140.  
  141.     AlertDialog :: DrawToScreen
  142.  
  143. \----------------------------------------------------------------------------*/
  144. void    AlertDialog :: DrawToScreen( rect *where , Boolean backGround )
  145. {
  146.     if( front )
  147.     {
  148.         if( where == NULL )
  149.         {
  150.             screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
  151.                         NULL , 0 , 0 , 0 );
  152.         }
  153.         else
  154.         {
  155.             screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
  156.                         where , 0 , 0 , 0 );
  157.         }
  158.     }
  159.     else
  160.     {
  161.         if( where == NULL )
  162.         {
  163.             screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
  164.                         NULL , kDrawTint , 16 , 0xffff );
  165.         }
  166.         else
  167.             screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
  168.                         where , kDrawTint , 16 , 0xffff );
  169.     }
  170. }